<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-comment">{- |
   Module      :  System.Win32.Automation.Input
   Copyright   :  2013 shelarcy
   License     :  BSD-style

   Maintainer  :  shelarcy@gmail.com
   Stability   :  Provisional
   Portability :  Non-portable (Win32 API)

   Provide sendInput function and INPUT types.
-}</span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Win32.Automation.Input</span><span>
</span><span id="line-14"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">sendInput</span><span>
</span><span id="line-15"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sendInputPtr</span><span>
</span><span id="line-16"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">makeKeyboardInput</span><span>
</span><span id="line-17"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">PINPUT</span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPINPUT</span><span>
</span><span id="line-19"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">INPUT</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-20"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">PHARDWAREINPUT</span><span>
</span><span id="line-21"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">HARDWAREINPUT</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getMessageExtraInfo</span><span>
</span><span id="line-23"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setMessageExtraInfo</span><span>
</span><span id="line-24"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Win32.Automation.Input.Key</span><span>
</span><span id="line-25"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Win32.Automation.Input.Mouse</span><span>
</span><span id="line-26"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Bits</span><span>                 </span><span class="hs-special">(</span><span> </span><span class="hs-special">(</span><span class="hs-operator">.|.</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Ptr</span><span>               </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Storable</span><span>          </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">Storable</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Marshal.Array</span><span>     </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">withArrayLen</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.C.Types</span><span>           </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">CIntPtr</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Graphics.Win32.Key</span><span>        </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">VKey</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">c_MapVirtualKey</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Automation.Input.Key</span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Automation.Input.Mouse</span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">MOUSEINPUT</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Automation.Input.Mouse</span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">MOUSEINPUT</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span>        </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">UINT</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPARAM</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Word</span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">DWORD</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">WORD</span><span> </span><span class="hs-special">)</span><span class="hs-cpp">



#include &quot;windows_cconv.h&quot;
</span><span>
</span><span id="line-44"></span><span>
</span><span id="line-45"></span><span class="hs-identifier">sendInput</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">INPUT</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-46"></span><span class="hs-identifier">sendInput</span><span> </span><span class="hs-identifier">input</span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">withArrayLen</span><span> </span><span class="hs-identifier">input</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">c_input</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-48"></span><span>      </span><span class="hs-identifier">sendInputPtr</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">c_input</span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">sendInputPtr</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-51"></span><span class="hs-comment">-- | Raw pointer of array version of 'sendInput'.</span><span>
</span><span id="line-52"></span><span class="hs-comment">-- Use this function to support non-list sequence.</span><span>
</span><span id="line-53"></span><span class="hs-identifier">sendInputPtr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">INPUT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-54"></span><span class="hs-identifier">sendInputPtr</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">c_input</span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;SendInput&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-56"></span><span>      </span><span class="hs-identifier">c_SendInput</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">c_input</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">undefined</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">INPUT</span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SendInput&quot;</span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-identifier">c_SendInput</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPINPUT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span class="hs-identifier">makeKeyboardInput</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">VKey</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">INPUT</span><span>
</span><span id="line-62"></span><span class="hs-identifier">makeKeyboardInput</span><span> </span><span class="hs-identifier">vkey</span><span> </span><span class="hs-identifier">flag</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-63"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">flag'</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">maybe</span><span> </span><span class="hs-identifier">kEYEVENTF_EXTENDEDKEY</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">kEYEVENTF_EXTENDEDKEY</span><span> </span><span class="hs-operator">.|.</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">flag</span><span>
</span><span id="line-64"></span><span>    </span><span class="hs-identifier">scan</span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">c_MapVirtualKey</span><span> </span><span class="hs-identifier">vkey</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-65"></span><span>    </span><span class="hs-identifier">dwExtraInfo'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">getMessageExtraInfo</span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">Keyboard</span><span>
</span><span id="line-67"></span><span>           </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">KEYBDINPUT</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-68"></span><span>                 </span><span class="hs-identifier">wVk</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">vkey</span><span>
</span><span id="line-69"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">wScan</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">scan</span><span>
</span><span id="line-70"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dwFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">flag'</span><span>
</span><span id="line-71"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">time</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-72"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dwExtraInfo</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">dwExtraInfo'</span><span>
</span><span id="line-73"></span><span>               </span><span class="hs-special">}</span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">PINPUT</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">INPUT</span><span>
</span><span id="line-76"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">LPINPUT</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">INPUT</span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">INPUT</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Mouse</span><span> </span><span class="hs-identifier">MOUSEINPUT</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">Keyboard</span><span> </span><span class="hs-identifier">KEYBDINPUT</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">OtherHardware</span><span> </span><span class="hs-identifier">HARDWAREINPUT</span><span>
</span><span id="line-79"></span><span>     </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-identifier">Show</span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier">Storable</span><span> </span><span class="hs-identifier">INPUT</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-special">(</span><span class="hs-number">40</span><span class="hs-special">)</span><span>
</span><span id="line-83"></span><span class="hs-pragma">{-# LINE 83 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-identifier">alignment</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">8</span><span>
</span><span id="line-84"></span><span class="hs-pragma">{-# LINE 84 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Mouse</span><span> </span><span class="hs-identifier">mouse</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-86"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-number">0</span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span class="hs-special">)</span><span>
</span><span id="line-87"></span><span class="hs-pragma">{-# LINE 87 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-87"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">mouse</span><span>
</span><span id="line-88"></span><span class="hs-pragma">{-# LINE 88 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Keyboard</span><span> </span><span class="hs-identifier">key</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-89"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-number">1</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span class="hs-pragma">{-# LINE 90 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-90"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">key</span><span>
</span><span id="line-91"></span><span class="hs-pragma">{-# LINE 91 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">OtherHardware</span><span> </span><span class="hs-identifier">hard</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-92"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-number">2</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span class="hs-special">)</span><span>
</span><span id="line-93"></span><span class="hs-pragma">{-# LINE 93 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-93"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">hard</span><span>
</span><span id="line-94"></span><span class="hs-pragma">{-# LINE 94 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-96"></span><span>        </span><span class="hs-identifier">type'</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-97"></span><span class="hs-pragma">{-# LINE 97 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-97"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">type'</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-98"></span><span>          </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-99"></span><span class="hs-pragma">{-# LINE 99 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-99"></span><span>              </span><span class="hs-identifier">Mouse</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">fmap</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-100"></span><span class="hs-pragma">{-# LINE 100 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-100"></span><span>          </span><span class="hs-number">1</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-101"></span><span class="hs-pragma">{-# LINE 101 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-101"></span><span>              </span><span class="hs-identifier">Keyboard</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">fmap</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-102"></span><span class="hs-pragma">{-# LINE 102 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-102"></span><span>          </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">OtherHardware</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">fmap</span><span class="hs-special">`</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-103"></span><span class="hs-pragma">{-# LINE 103 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">PHARDWAREINPUT</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">HARDWAREINPUT</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">HARDWAREINPUT</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">HARDWAREINPUT</span><span>
</span><span id="line-108"></span><span>     </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">uMsg</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-109"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">wParamL</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">WORD</span><span>
</span><span id="line-110"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">wParamH</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">WORD</span><span>
</span><span id="line-111"></span><span>     </span><span class="hs-special">}</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-identifier">Show</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier">Storable</span><span> </span><span class="hs-identifier">HARDWAREINPUT</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-special">(</span><span class="hs-number">8</span><span class="hs-special">)</span><span>
</span><span id="line-115"></span><span class="hs-pragma">{-# LINE 115 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-identifier">alignment</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">4</span><span>
</span><span id="line-116"></span><span class="hs-pragma">{-# LINE 116 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-116"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">input</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-117"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span>    </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">uMsg</span><span> </span><span class="hs-identifier">input</span><span class="hs-special">)</span><span>
</span><span id="line-118"></span><span class="hs-pragma">{-# LINE 118 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-118"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">wParamL</span><span> </span><span class="hs-identifier">input</span><span class="hs-special">)</span><span>
</span><span id="line-119"></span><span class="hs-pragma">{-# LINE 119 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-119"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">6</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">wParamH</span><span> </span><span class="hs-identifier">input</span><span class="hs-special">)</span><span>
</span><span id="line-120"></span><span class="hs-pragma">{-# LINE 120 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-121"></span><span>        </span><span class="hs-identifier">uMsg'</span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-122"></span><span class="hs-pragma">{-# LINE 122 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-122"></span><span>        </span><span class="hs-identifier">wParamL'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-123"></span><span class="hs-pragma">{-# LINE 123 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-123"></span><span>        </span><span class="hs-identifier">wParamH'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">6</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-124"></span><span class="hs-pragma">{-# LINE 124 &quot;libraries\\Win32\\System\\Win32\\Automation\\Input.hsc&quot; #-}</span><span>
</span><span id="line-124"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">HARDWAREINPUT</span><span> </span><span class="hs-identifier">uMsg'</span><span> </span><span class="hs-identifier">wParamL'</span><span> </span><span class="hs-identifier">wParamH'</span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMessageExtraInfo&quot;</span><span>
</span><span id="line-127"></span><span>    </span><span class="hs-identifier">getMessageExtraInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">LPARAM</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetMessageExtraInfo&quot;</span><span>
</span><span id="line-130"></span><span>    </span><span class="hs-identifier">setMessageExtraInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPARAM</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">LPARAM</span><span>
</span><span id="line-131"></span></pre></body></html>